/*
 * @Author: yhy
 * @Date: 2022-03-15 09:50:05
 * @LastEditTime: 2022-04-12 12:13:24
 * @LastEditors: yhy
 * @Description:
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import layout from '@/views/Layout'
import Home from '@/views/Home/Home'
import User from '@/views//User/User'
import Search from '@/views/Search'
import SearchResult from '@/views/Search/SearchResult'

Vue.use(VueRouter)

const routes = [
  // 刚进入页面时路由初定向
  { path: '/', redirect: '/layout/home' },
  { path: '/login', component: Login },
  // layout页面
  {
    path: '/layout',
    component: layout,
    children: [
      { path: 'home', component: Home },
      { path: 'user', component: User }
    ]
  },
  // 搜索页面
  { path: '/search', component: Search },
  // 搜索结果页面
  { path: '/search_Result/:keywords', component: SearchResult }
]

const router = new VueRouter({
  routes
})

export default router
